package com.ruoyi.weiriya.mapper;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.ruoyi.weiriya.domain.WArea;
import com.ruoyi.weiriya.domain.WDoor;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 门禁列Mapper接口
 * 
 * @author ruoyi
 * @date 2023-08-24
 */
public interface WDoorMapper extends BaseMapper<WDoor>
{
    @Select("SELECT d.*, a.name as area_name " +
            "FROM w_door d " +
            "LEFT JOIN w_area a on a.id = d.area_id ${ew.customSqlSegment}")
    List<WDoor> getList(@Param(Constants.WRAPPER) QueryWrapper<WDoor> queryWrapper);

    @Select("SELECT d.*, a.name as area_name " +
            "FROM w_door d " +
            "LEFT JOIN w_area a on a.id = d.area_id " +
            "WHERE d.id = #{id}")
    WDoor getWDoorById(String id);
}
